Framework EDI Reference. Methods and Properties
ediSecurities. ExportCertificate

Exports an X.509 certificate from the default certificate store.

Syntax:

Parameters:

Returns:

Returns 1 if the operation is successful; otherwise returns 0 if the operation fails.

Remarks:

The sSubjectName, sIssuerName and sHexSerialNumber are used to search for the certificate in the certificate store.  See Locating a Digital Certificate.

The default certificate store is specified by the properties DefaultCertSystemStoreName and DefaultCertSystemStoreLocation.

Example:

Dim oEdiDoc As Fredi.ediDocument
Dim oSecurities As Fredi.ediSecurities

' Create instance of Framework EDI.
Set oEdiDoc = New Fredi.ediDocument

' Get securities object.
Set oSecurities = oEdiDoc.GetSecurities

' Set the default certificate store
oSecurities.DefaultCertSystemStoreName = "My" ' Case sensitive

' Set the default certificate store location
oSecurities.DefaultCertSystemStoreLocation = "CurrentUser"

' Export test certificate.
If oSecurities.ExportCertificate("Edidev Test Certificate", "Edidev Test Certificate", "", App.Path & "\MyExportedTestCert.cer") = 1 Then
MsgBox "Successfully exported test certificate 'Edidev Test Certificate' to MyExportedTestCert.cer."

Else
MsgBox "Failed to create certificate"

End If

Sample

M_ExportCertificate.zip